package ftp;

import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class FtpServer {
	public static void main(String[] args) throws Exception{
		ServerSocket server =new ServerSocket(5555);
		Socket socket = server.accept();
		InputStream fin = new FileInputStream("product-1-bk-sml.jpg");
		OutputStream nout = socket.getOutputStream();
		byte[] buffer= new byte[256];
		int len=0;
		
		while((len = fin.read(buffer))!=-1){
			System.out.println(len);
			nout.write(buffer,0,len);
		}
		fin.close();
		nout.close();
		socket.close();
		server.close();
		}
}
